package cn.huiyunche.bms.backend.service;

import cn.huiyunche.bms.backend.bo.PayableBillBO;
import cn.huiyunche.bms.backend.bo.PaymentBO;
import cn.huiyunche.bms.backend.query.PayableBillConditions;
import cn.huiyunche.bms.backend.query.WayBillDetailConditions;
import cn.huiyunche.bms.base.model.BmsPayableFeeDetail;
import cn.huiyunche.bms.base.model.BmsPayableFeeDetailTemp;
import cn.huiyunche.commons.domain.PageVo;

import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2017/7/6 0006.
 */
public interface PayableService {

    /**
     * 查询应付账单
     * @param pageVo
     * @param conditions
     * @return
     */
    Map<String, Object> selectListByConditions(PageVo pageVo ,PayableBillConditions conditions) throws Exception;

    /**
     * 获取应付费用明细 对象
     * @param id
     * @return
     */
    BmsPayableFeeDetailTemp  getAlterCost(Integer id);

    /**
     * 修改调整金额
     * @param payableBillBO
     * @return
     */
    int updateAlterCost(PayableBillBO payableBillBO);


    /**
     * 移除
     * @param id
     * @return
     */
    int deletePayableFeeDetailTemp(Integer id);


    /**
     * 生成账单
     * 将费用详情临时表相关数据 插入到正式费用详情表,同时插入到应付表
     * @param versionNo
     * @return
     */
    int generateBill(String versionNo ,String invoiceStatus , String username);

    /**
     * 删除账单
     * @param ids
     * @return
     */
    void deletePayable(List ids);

    /**
     * 确认账单 根据账单查询费用详情相关
     * @param id
     * @return
     */
    Map<String, Object> confirmPayableBill(Integer id , PageVo pageVo);


    /**
     * 确认账单页面移除  同时调整账单表金额
     * @param id
     * @return
     */
    int deletePayableFeeDetail(Integer id);


    /**
     * 获取正式表对象
     * @param id
     * @return
     */
    BmsPayableFeeDetail getPayableFeeDetail(Integer id);


    /**
     * 修改费用详情表金额
     * @param payableBillBO
     * @return
     */
    int updatePayableFeeDetail(PayableBillBO payableBillBO);


    /**
     *
     * @param invoiceStatus
     * @return
     */
    int createPayableBill(String invoiceStatus ,Integer billId) throws Exception;

    /**
     *查询(不属于任何账单)运单
     * @param pageVo
     * @param conditions
     * @return
     */
    Map<String, Object> selectWaybillDetaiByConditions(PageVo pageVo , WayBillDetailConditions conditions) throws Exception;

    /**
     * 查询订单 下一步
     * 将订单数据插入到临时表中
     * 并根据版本号查询费用明细表相关数据
     * @param ids
     * @return
     */
//    Map<String, Object> selectWaybillDetaiByIds(String ids);


    /**
     * 将选中的运单数据插入临时表
     * @param ids
     * @return
     */
    String insertTemp(List ids);

    /**
     * 下一步插入成功后展示
     * @param versionNo
     * @return
     */
    Map<String, Object> selectTempListByVersionNo(String versionNo);

    /**
     * 
     * @param id
     * @return
     */
    Map<String, Object> paymentList(Integer id);


    /**
     * 确认付款
     * @param formBo
     * @return
     */
    int confirmPayment(PaymentBO formBo) throws Exception;

    /**
     * 付款管理页面
     * @param pageVo
     * @param conditions
     * @return
     */
    Map<String, Object> selectPaymentList(PageVo pageVo, PayableBillConditions conditions) throws Exception;

    /**
     *批量导出账单
     * @param ids
     * @param res
     */
    void exportBillDetail(List ids, HttpServletResponse res) throws Exception;

    /**
     *批量导出账单
     * @param ids
     * @param res
     */
    void exportPayment(List ids, HttpServletResponse res) throws Exception;
}
